<template>
    <div class="zmxqCard">
        <div class="fri">
            <div class="fri-img"><img :src="require('@/assets/imgs/' + zmxqlist.urlImg)" alt=""></div>
            <div class="fri-introduce">
                <span>{{ zmxqlist.title }}</span>
            </div>
        </div>
        <div class="two">
            <i></i><div class="two-title">采购需求</div><i></i>
        </div>
        <div class="thr">
            <div class="thr-card" v-for="item in zmxqlist.list" :key="item.id" @click="changeState($event)">
                <div class="thr-name">{{item.content}}</div>
                <i class="thr-right"></i>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    props: ['zmxqlist'],
    data() {
        return {

        };
    },
    methods: {
        changeState(e){
            let thr = document.querySelectorAll('.thr-card');
            let thrName = document.querySelectorAll('.thr-name');
            let thrRright = document.querySelectorAll('.thr-right');
            thr.forEach((item, i) => {
                item.classList.remove('alive');
            })
            thrRright.forEach((item, i) => {
                item.classList.remove('thr-right-alive');
            })
            thrName.forEach((item, i) => {
            thrName[i].style.color = "#3995C0";
            })
            e.currentTarget.classList.add('alive');
            e.currentTarget.firstElementChild.style.color = "#fff";
            e.currentTarget.lastElementChild.classList.add('thr-right-alive');
        }
    }
}
</script>
<style lang="less" scoped>
    .zmxqCard{
        width: 7.06rem;
        height: 4.89rem;
        background-color: #fff;
        padding-top: 0.226rem;
        .fri{
            width: 6.66rem;
            height: 1.02rem;
            margin: 0 auto;
            display: flex;
            .fri-img{
                width: 1.88rem;
                height: 1rem;
                border: 1px solid #D9D9D9;
                img{
                    width: 100%;
                    height: 100%;
                }
            }
            .fri-introduce{
                width: 4.63rem;
                // height: 1rem;
                margin-left: 0.15rem;
                span{
                    font-size: 0.24rem;
                    color: #333333;
                    text-align: justify;
                    font-weight: bold;
                }
            }
        }
        .two{
            width: 6.66rem;
            height: 0.372rem;
            margin-top: 0.268rem;
            background-image: linear-gradient(270deg, rgba(255,255,255,0.00) 0%, rgba(240, 120, 66, 0.22) 52%, rgba(255,255,255,0.00) 100%);
            display: flex;
            justify-content: center;
            align-items: center;
            .two-title{
                font-size: 0.2rem;
                font-weight: bold;
                margin: 0 0.08rem;
                color: #F07842;
                text-align: center;
            }
            i{
                display: block;
                width: 0.14rem;
                height: 0.1rem;
                background: url(@/assets/imgs/多边形-三角.png) no-repeat;
                background-size: contain;
            }
        }
        .thr{
            margin: 0.3rem auto;
            width: 6.66rem;
            height: 2.46rem;
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
            .thr-card{
                width: 1.59rem;
                height: 0.54rem;
                background: rgba(96, 215, 177, 0.13);
                border-radius: 0.05rem;
                display: flex;
                align-items: center;
                justify-content: space-between;
            }
            .thr-card:last-child:nth-child(4n + 2) {
                margin-right: calc((100% - 1.59rem) / 3 * 2);
            }
            .thr-card:last-child:nth-child(4n + 3) {
                margin-right: calc((100% - 1.59rem) / 3 * 1);
            }
            .thr-name{
                font-size: 0.2rem;
                color: #3995C0;
                line-height: 0.54rem;
                margin-left: 0.1rem; 
                overflow:hidden;
                white-space:nowrap;
                text-overflow:ellipsis;
                width: 1.17rem;
            }
            .thr-name-alive{
                color: #fff;
            }
            .thr-right{
                display: block;
                width: 0.1rem;
                height: 0.15rem;
                margin-right: 0.1rem;
                background: url(@/assets/imgs/图标-招募需求-箭头-1.png);
                background-size: contain;
            }
            .thr-right-alive{
                display: block;
                width: 0.1rem;
                height: 0.15rem;
                margin-right: 0.1rem;
                background: url(@/assets/imgs/图标-招募需求-箭头-2.png);
                background-size: contain;
            }
            .alive{
                background-image: linear-gradient(90deg, #3793C0 0%, #57DCF0 100%);
                border-radius: 4.95px;
                border-radius: 4.95px;
            }
        }
    }
</style>